const express = require('express')
const cors = require('cors')
const mock = require('./demo.json')

const app = express()

app.use(cors())

const router = express.Router()

router.post('/user', (req, res) => {
  res.json(mock.user)
})
router.get('/user', (req, res) => {
  res.json(mock.user)
})

router.post('/list', (req, res) => {
  res.json(mock.list)
})
router.get('/list', (req, res) => {
  res.json(mock.list)
})

router.post('/logo', (req, res) => {
  res.json(mock.logo)
})
router.get('/logo', (req, res) => {
  res.json(mock.logo)
})

router.post('/page', (req, res) => {
  res.json(mock.page)
})
router.get('/page', (req, res) => {
  res.json(mock.page)
})


router.post('/userId', (req, res) => {
  res.json(mock.userId)
})
router.get('/userId', (req, res) => {
  res.json(mock.userId)
})

router.post('/moduleTree', (req, res) => {
  res.json(mock.moduleTree)
})
router.get('/moduleTree', (req, res) => {
  res.json(mock.moduleTree)
})

router.post('/buildings/:id', (req, res) => {
  res.json(mock.buildings)
})
router.get('/buildings/:id', (req, res) => {
  res.json(mock.buildings)
})

router.post('/cdt', (req, res) => {
  res.json(mock.cdt)
})
router.get('/cdt', (req, res) => {
  res.json(mock.cdt)
})


app.use(router)

app.listen(3000, () => {
  console.log('监听3000');
})